import request from '@/utils/request';

// 获取社区结算配置
export function creationSet(pram){
    return request({
        url: '/admin/platform/community/setting/settlement',
        method: 'get',
        params: pram,
    });
}

// 更新社区结算配置
export function creationUpdate(pram){
    const data = {
        communitySettingSettlementFreezeDay: pram.communitySettingSettlementFreezeDay,
        communitySettingSettlementFreezeType: pram.communitySettingSettlementFreezeType,
        communitySettingSettlementMinimumWithdrawalAmount: pram.communitySettingSettlementMinimumWithdrawalAmount,
        communitySettingSettlementRebatePercent: pram.communitySettingSettlementRebatePercent
    }
    console.log(data)
    return request({
        url: '/admin/platform/community/setting/settlement',
        method: 'POST',
        data: data,
    });
}

// 社区问题
export function questionList(pram){
    return request({
        url: '/admin/platform/community/question/list',
        method: 'get',
        params: pram,
    });
}

// 新增社区问题
export function questionAdd(pram){
    const data = {
        content: pram.content,
        title: pram.title,
        sort: pram.sort,
        id: pram.id
    }
    return request({
        url: '/admin/platform/community/question/save',
        method: 'POST',
        data: data,
    });
}

// 社区问题删除
export function questionDel(pram){
    return request({
        url: '/admin/platform/community/question/delete',
        method: 'get',
        params: pram,
    });
}

// 社区问题更新
export function questionUpdate(pram){
    const data = {
        content: pram.content,
        title: pram.title,
        sort: pram.sort,
        id: pram.id
    }
    return request({
        url: '/admin/platform/community/question/update',
        method: 'POST',
        data: data,
    });
}

// 种草官列表
export function settlementList(pram){
    return request({
        url: '/admin/platform/community/recommender/page',
        method: 'get',
        params: pram,
    });
}


// 种草官订单列表
export function settlementOrderList(pram){
    return request({
        url: '/admin/platform/community/order/page',
        method: 'get',
        params: pram,
    });
}

// 种草官结算列表
export function closingList(pram){
    return request({
        url: '/admin/platform/community/settlement/page',
        method: 'get',
        params: pram,
    });
}

// 种草官结算处理
export function auditApi(pram){
    const data = {
        id: pram.id,
        reason: pram.reason,
        status: pram.status,
    }
    return request({
        url: '/admin/platform/community/settlement/audit',
        method: 'POST',
        data: data,
    });
}

// 官方列表
export function officialList(pram){
    return request({
        url: '/admin/platform/community/note/official/page',
        method: 'get',
        params: pram,
    });
}


// 发布官方
export function publishApi(pram){
    const data = {
        categoryId: pram.categoryId,
        content: pram.content,
        cover: pram.cover,
        extraGroups: pram.extraGroups,
        title: pram.title,
        uid: pram.uid,
        auditStatus: pram.auditStatus
    }
    return request({
        url: '/admin/platform/community/note/official/create',
        method: 'POST',
        data: data,
    });
}

// 官方用户列表
export function officialUserList(pram){
    return request({
        url: '/admin/platform/user/official/list',
        method: 'get',
        params: pram,
    });
}

// 内容详情
export function officialDetailt(id){
    return request({
        url: `/admin/platform/community/note/detail/${id}`,
        method: 'get',
    });
}











